<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>bash trap | Matrix207&#39;s Blog</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="From http://blog.charlee.li/bash-pitfalls/
感谢fcicq，他的new 30 days系列为我们带来了不少好文章。
今天想分析的是这篇Bash Pitfalls, 介绍了一些bash编程中的经典错误。fcicq说可能不适合初学者，而我认为， 正是bash编程的初学者才应该好好阅读一下这篇文章。
下面就逐个分析一下这篇文章中提到的错误。不是完全的翻译，有些没">
<meta property="og:type" content="article">
<meta property="og:title" content="bash trap">
<meta property="og:url" content="http://yoursite.com/2014/09/06/bash-trap/index.html">
<meta property="og:site_name" content="Matrix207's Blog">
<meta property="og:description" content="From http://blog.charlee.li/bash-pitfalls/
感谢fcicq，他的new 30 days系列为我们带来了不少好文章。
今天想分析的是这篇Bash Pitfalls, 介绍了一些bash编程中的经典错误。fcicq说可能不适合初学者，而我认为， 正是bash编程的初学者才应该好好阅读一下这篇文章。
下面就逐个分析一下这篇文章中提到的错误。不是完全的翻译，有些没">
<meta property="og:updated_time" content="2016-07-17T14:33:54.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="bash trap">
<meta name="twitter:description" content="From http://blog.charlee.li/bash-pitfalls/
感谢fcicq，他的new 30 days系列为我们带来了不少好文章。
今天想分析的是这篇Bash Pitfalls, 介绍了一些bash编程中的经典错误。fcicq说可能不适合初学者，而我认为， 正是bash编程的初学者才应该好好阅读一下这篇文章。
下面就逐个分析一下这篇文章中提到的错误。不是完全的翻译，有些没">
  
    <link rel="alternate" href="/atom.xml" title="Matrix207&#39;s Blog" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/css/style.css">
  

</head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">Matrix207&#39;s Blog</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="Flux RSS"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Rechercher"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" results="0" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://yoursite.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main"><article id="post-bash-trap" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/09/06/bash-trap/" class="article-date">
  <time datetime="2014-09-05T16:00:00.000Z" itemprop="datePublished">2014-09-06</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/language/">language</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 class="article-title" itemprop="name">
      bash trap
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>From <a href="http://blog.charlee.li/bash-pitfalls/" target="_blank" rel="external">http://blog.charlee.li/bash-pitfalls/</a></p>
<p>感谢fcicq，他的new 30 days系列为我们带来了不少好文章。</p>
<p>今天想分析的是这篇Bash Pitfalls, 介绍了一些bash编程中的经典错误。fcicq说可能不适<br>合初学者，而我认为， 正是bash编程的初学者才应该好好阅读一下这篇文章。</p>
<p>下面就逐个分析一下这篇文章中提到的错误。不是完全的翻译，有些没用的话就略过了，<br>有些地方则加了些注释。</p>
<ul>
<li>1.for i in `ls *.mp3`</li>
</ul>
<p>常见的错误写法：</p>
<pre><code>for i in `ls *.mp3`; do     # Wrong!
</code></pre><p>为什么错误呢？因为for…in语句是按照空白来分词的，包含空格的文件名会被拆成多个词。<br>如遇到 01 - Don’t Eat the Yellow Snow.mp3 时，i的值会依次取 01，-，Don’t，等等。</p>
<p>用双引号也不行，它会将ls *.mp3的全部结果当成一个词来处理。</p>
<pre><code>for i in &quot;`ls *.mp3`&quot;; do   # Wrong!
</code></pre><p>正确的写法是</p>
<pre><code>for i in *.mp3; do
</code></pre><ul>
<li>2.<code>cp $file $target</code></li>
</ul>
<p>这句话基本上正确，但同样有空格分词的问题。所以应当用双引号：</p>
<pre><code>cp &quot;$file&quot; &quot;$target&quot;
</code></pre><p>但是如果凑巧文件名以 - 开头，这个文件名会被 cp 当作命令行选项来处理，依旧很头疼。<br>可以试试下面这个。</p>
<pre><code>cp -- &quot;$file&quot; &quot;$target&quot;
</code></pre><p>运气差点的再碰上一个不支持 – 选项的系统，那只能用下面的方法了：使每个变量都以目录开头。</p>
<pre><code>for i in ./*.mp3; do
  cp &quot;$i&quot; /target
  ...
</code></pre><ul>
<li>3.<code>[ $foo = &quot;bar&quot; ]</code></li>
</ul>
<p>当$foo为空时，上面的命令就变成了</p>
<pre><code>[ = &quot;bar&quot; ]
</code></pre><p>类似地，当$foo包含空格时：</p>
<pre><code>[ multiple words here = &quot;bar&quot; ]
</code></pre><p>两者都会出错。所以应当用双引号将变量括起来：</p>
<pre><code>[ &quot;$foo&quot; = bar ]      # 几乎完美了。
</code></pre><p>但是当$foo以 - 开头时依然会有问题。 在较新的bash中你可以用下面的方法来代替，<br>[[ 关键字能正确处理空白、空格、带横线等问题。</p>
<pre><code>[[ $foo = bar ]]      # 正确
</code></pre><p>旧版本bash中可以用这个技巧（虽然不好理解）：</p>
<pre><code>[ x&quot;$foo&quot; = xbar ]    # 正确
</code></pre><p>或者干脆把变量放在右边，因为 [ 命令的等号右边即使是空白或是横线开头，依然能正常<br>工作。 （Java编程风格中也有类似的做法，虽然目的不一样。）</p>
<pre><code>[ bar = &quot;$foo&quot; ]      # 正确
</code></pre><ul>
<li>4.cd `dirname “$f”`</li>
</ul>
<p>同样也存在空格问题。那么加上引号吧。</p>
<pre><code>cd &quot;`dirname &quot;$f&quot;`&quot;
</code></pre><p>问题来了，是不是写错了？由于双引号的嵌套，你会认为<code>dirname 是第一个字符串，</code>是<br>第二个字符串。 错了，那是C语言。在bash中，命令替换（反引号``中的内容）里面的双引<br>号会被正确地匹配到一起， 不用特意去转义。</p>
<p>$()语法也相同，如下面的写法是正确的。</p>
<pre><code>cd &quot;$(dirname &quot;$f&quot;)&quot;
</code></pre><ul>
<li>5.<code>[ &quot;$foo&quot; = bar &amp;&amp; &quot;$bar&quot; = foo ]</code></li>
</ul>
<p>[ 中不能使用 &amp;&amp; 符号！因为 [ 的实质是 test 命令，&amp;&amp; 会把这一行分成两个命令的。应<br>该用以下的写法。</p>
<pre><code>[ bar = &quot;$foo&quot; -a foo = &quot;$bar&quot; ]       # Right!
[ bar = &quot;$foo&quot; ] &amp;&amp; [ foo = &quot;$bar&quot; ]   # Also right!
[[ $foo = bar &amp;&amp; $bar = foo ]]         # Also right!
</code></pre><ul>
<li>6.<code>[ $foo &gt; 7 ]</code></li>
</ul>
<p>很可惜 [[ 只适用于字符串，不能做数字比较。数字比较应当这样写：</p>
<pre><code>(( $foo &gt; 7 ))
</code></pre><p>或者用经典的写法：</p>
<pre><code>[ $foo -gt 7 ]
</code></pre><p>但上述使用 -gt 的写法有个问题，那就是当 $foo 不是数字时就会出错。你必须做好类型检验。</p>
<p>这样写也行。</p>
<pre><code>[[ $foo -gt 7 ]]
</code></pre><ul>
<li>7.<code>grep foo bar | while read line; do ((count++)); done</code></li>
</ul>
<p>这行代码数出bar文件中包含foo的行数，虽然很麻烦（等同于<code>grep -c foo bar</code>或者 <code>grep 
foo bar | wc -l</code>）。 乍一看没有问题，但执行之后count变量却没有值。因为管道中的每<br>个命令都放到一个新的子shell中执行， 所以子shell中定义的count变量无法传递出来。</p>
<ul>
<li>8.<code>if [grep foo myfile]</code></li>
</ul>
<p>初学者常犯的错误，就是将 if 语句后面的 [ 当作if语法的一部分。实际上它是一个命令<br>，相当于 test 命令， 而不是 if 语法。这一点C程序员特别应当注意。</p>
<p>if 会将 if 到 then 之间的所有命令的返回值当作判断条件。因此上面的语句应当写成</p>
<pre><code>if grep foo myfile &gt; /dev/null; then
</code></pre><ul>
<li>9.<code>if [bar=&quot;$foo&quot;]</code></li>
</ul>
<p>同样，[ 是个命令，不是 if 语句的一部分，所以要注意空格。</p>
<pre><code>if [ bar = &quot;$foo&quot; ]
</code></pre><ul>
<li>10.<code>if [ [ a = b ] &amp;&amp; [ c = d ] ]</code></li>
</ul>
<p>同样的问题，[ 不是 if 语句的一部分，当然也不是改变逻辑判断的括号。它是一个命令。<br>可能C程序员比较容易犯这个错误？</p>
<pre><code>if [ a = b ] &amp;&amp; [ c = d ]        # 正确
</code></pre><ul>
<li>11.<code>cat file | sed s/foo/bar/ &gt; file</code></li>
</ul>
<p>你不能在同一条管道操作中同时读写一个文件。根据管道的实现方式，file要么被截断成0<br>字节，要么会无限增长直到填满整个硬盘。 如果想改变原文件的内容，只能先将输出写到<br>临时文件中再用mv命令。</p>
<pre><code>sed &apos;s/foo/bar/g&apos; file &gt; tmpfile &amp;&amp; mv tmpfile file
</code></pre><ul>
<li>12.<code>echo $foo</code></li>
</ul>
<p>这句话还有什么错误码？一般来说是正确的，但下面的例子就有问题了。</p>
<pre><code>MSG=&quot;Please enter a file name of the form *.zip&quot;
echo $MSG         # 错误！
</code></pre><p>如果恰巧当前目录下有zip文件，就会显示成</p>
<pre><code>Please enter a file name of the form freenfss.zip lw35nfss.zip
</code></pre><p>所以即使是echo也别忘记给变量加引号。</p>
<ul>
<li>13.<code>$foo=bar</code></li>
</ul>
<p>变量赋值时无需加 $ 符号——这不是Perl或PHP。</p>
<ul>
<li>14.<code>foo = bar</code></li>
</ul>
<p>变量赋值时等号两侧不能加空格——这不是C语言。</p>
<ul>
<li>15.<code>echo &lt;&lt;EOF</code></li>
</ul>
<p>here document是个好东西，它可以输出成段的文字而不用加引号也不用考虑换行符的处理<br>问题。 不过here document输出时应当使用cat而不是echo。</p>
<pre><code># This is wrong:
echo &lt;&lt;EOF
Hello world
EOF


# This is right:
cat &lt;&lt;EOF
Hello world
EOF
</code></pre><ul>
<li>16.<code>su -c &#39;some command&#39;</code></li>
</ul>
<p>原文的意思是，这条基本上正确，但使用者的目的是要将 -c ‘some command’ 传给shell。<br>而恰好 su 有个 -c 参数，所以su 只会将 ‘some command’ 传给shell。所以应该这么写：</p>
<pre><code>su root -c &apos;some command&apos;
</code></pre><p>但是在我的平台上，man su 的结果中关于 -c 的解释为</p>
<pre><code>-c, --commmand=COMMAND
            pass a single COMMAND to the shell with -c
</code></pre><p>也就是说，-c ‘some command’ 同样会将 -c ‘some command’ 这样一个字符串传递给shell<br>， 和这条就不符合了。不管怎样，先将这一条写在这里吧。</p>
<ul>
<li>17.<code>cd /foo; bar</code></li>
</ul>
<p>cd有可能会出错，出错后 bar 命令就会在你预想不到的目录里执行了。所以一定要记得判断cd的返回值。</p>
<pre><code>cd /foo &amp;&amp; bar
</code></pre><p>如果你要根据cd的返回值执行多条命令，可以用 ||。</p>
<pre><code>cd /foo || exit 1;
bar
baz
</code></pre><p>关于目录的一点题外话，假设你要在shell程序中频繁变换工作目录，如下面的代码：</p>
<pre><code>find ... -type d | while read subdir; do
  cd &quot;$subdir&quot; &amp;&amp; whatever &amp;&amp; ... &amp;&amp; cd -
done
</code></pre><p>不如这样写：</p>
<pre><code>find ... -type d | while read subdir; do
  (cd &quot;$subdir&quot; &amp;&amp; whatever &amp;&amp; ...)
done
</code></pre><p>括号会强制启动一个子shell，这样在这个子shell中改变工作目录不会影响父shell（执行<br>这个脚本的shell）， 就可以省掉cd - 的麻烦。</p>
<p>你也可以灵活运用 pushd、popd、dirs 等命令来控制工作目录。</p>
<ul>
<li>18.<code>[ bar == &quot;$foo&quot; ]</code></li>
</ul>
<p>[ 命令中不能用 ==，应当写成</p>
<pre><code>[ bar = &quot;$foo&quot; ] &amp;&amp; echo yes
[[ bar == $foo ]] &amp;&amp; echo yes
</code></pre><ul>
<li>19.<code>for i in {1..10}; do ./something &amp;; done</code></li>
</ul>
<p>&amp; 后面不应该再放 ; ，因为 &amp; 已经起到了语句分隔符的作用，无需再用;。</p>
<pre><code>for i in {1..10}; do ./something &amp; done
</code></pre><ul>
<li>20.<code>cmd1 &amp;&amp; cmd2 || cmd3</code></li>
</ul>
<p>有人喜欢用这种格式来代替 if…then…else 结构，但其实并不完全一样。如果cmd2返回<br>一个非真值，那么cmd3则会被执行。 所以还是老老实实地用 if cmd1; then cmd2; else<br>cmd3 为好。</p>
<ul>
<li>21.UTF-8的BOM(Byte-Order Marks)问题</li>
</ul>
<p>UTF-8编码可以在文件开头用几个字节来表示编码的字节顺序，这几个字节称为BOM。但Unix<br>格式的UTF-8编码不需要BOM。 多余的BOM会影响shell解析，特别是开头的 #!/bin/sh 之类<br>的指令将会无法识别。</p>
<p>MS-DOS格式的换行符(CRLF)也存在同样的问题。如果你将shell程序保存成DOS格式，脚本就无法执行了。</p>
<pre><code>$ ./dos
-bash: ./dos: /bin/sh^M: bad interpreter: No such file or directory
</code></pre><ul>
<li>22.<code>echo &quot;Hello World!&quot;</code></li>
</ul>
<p>交互执行这条命令会产生以下的错误：</p>
<pre><code>-bash: !&quot;: event not found
</code></pre><p>因为 !” 会被当作命令行历史替换的符号来处理。不过在shell脚本中没有这样的问题。</p>
<p>不幸的是，你无法使用转义符来转义!：</p>
<pre><code>$ echo &quot;hi\!&quot;
hi\!
</code></pre><p>解决方案之一，使用单引号，即</p>
<pre><code>$ echo &apos;Hello, world!&apos;
</code></pre><p>如果你必须使用双引号，可以试试通过 set +H 来取消命令行历史替换。</p>
<pre><code>set +H
echo &quot;Hello, world!&quot;
</code></pre><ul>
<li>23.<code>for arg in $*</code></li>
</ul>
<p>$*表示所有命令行参数，所以你可能想这样写来逐个处理参数，但参数中包含空格时就会失败。如：</p>
<pre><code>#!/bin/bash
# Incorrect version
for x in $*; do
  echo &quot;parameter: &apos;$x&apos;&quot;
done


$ ./myscript &apos;arg 1&apos; arg2 arg3
parameter: &apos;arg&apos;
parameter: &apos;1&apos;
parameter: &apos;arg2&apos;
parameter: &apos;arg3&apos;
</code></pre><p>正确的方法是使用 $@。</p>
<pre><code>#!/bin/bash
# Correct version
for x in &quot;$@&quot;; do
  echo &quot;parameter: &apos;$x&apos;&quot;
done


$ ./myscript &apos;arg 1&apos; arg2 arg3
parameter: &apos;arg 1&apos;
parameter: &apos;arg2&apos;
parameter: &apos;arg3&apos;
</code></pre><p>在 bash 的手册中对 $* 和 $@ 的说明如下：</p>
<pre><code>*    Expands to the positional parameters, starting from one.  
     When the expansion occurs within double quotes, it 
     expands to a single word with the value of each parameter 
     separated by the first character of the IFS special variable.  
     That is, &quot;$*&quot; is equivalent to &quot;$1c$2c...&quot;,
@    Expands to the positional parameters, starting from one. 
     When the expansion occurs within double quotes, each 
     parameter expands to a separate word.  That  is,  &quot;$@&quot;  
     is equivalent to &quot;$1&quot; &quot;$2&quot; ...  
</code></pre><p>可见，不加引号时 $<em> 和 $@ 是相同的，但$</em> 会被扩展成一个字符串，而 $@ 会 被扩展成每一个参数。</p>
<ul>
<li>24.<code>function foo()</code></li>
</ul>
<p>在bash中没有问题，但其他shell中有可能出错。不要把 function 和括号一起使用。 最为<br>保险的做法是使用括号，即</p>
<pre><code>foo() {
  ...
}
</code></pre>
      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/09/06/bash-trap/" data-id="ciqqpe1rb00b0nmpvpvmz84xu" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/shell/">shell</a></li></ul>

    </footer>
  </div>
  
    
<nav id="article-nav">
  
    <a href="/2014/09/07/sync/" id="article-nav-newer" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Récent</strong>
      <div class="article-nav-title">
        
          sync
        
      </div>
    </a>
  
  
    <a href="/2014/09/02/mbr/" id="article-nav-older" class="article-nav-link-wrap">
      <strong class="article-nav-caption">Ancien</strong>
      <div class="article-nav-title">mbr</div>
    </a>
  
</nav>

  
</article>

</section>
        
          <aside id="sidebar">
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Catégories</h3>
    <div class="widget">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/blog/">blog</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/database/">database</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/english/">english</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/kernel/">kernel</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/language/">language</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/linux/">linux</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/math/">math</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/network/">network</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/others/">others</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/person/">person</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/program/">program</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/source/">source</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/storage/">storage</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/tools/">tools</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/windows/">windows</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Mot-clés</h3>
    <div class="widget">
      <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/FAQ/">FAQ</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/IRC/">IRC</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Translation/">Translation</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/android/">android</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/api/">api</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/assembly/">assembly</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/awk/">awk</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/batch/">batch</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/blog/">blog</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/book/">book</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/c/">c</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/c/">c++</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/cache/">cache</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/crash/">crash</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/database/">database</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/debug/">debug</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/dot/">dot</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/driver/">driver</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/emacs/">emacs</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/exploit/">exploit</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/file-system/">file system</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/filesystem/">filesystem</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/flowchart/">flowchart</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/gcc/">gcc</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/git/">git</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/google/">google</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/graphviz/">graphviz</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hexo/">hexo</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hosts/">hosts</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/iscsi/">iscsi</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/java/">java</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/javascript/">javascript</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/job/">job</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/json/">json</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/kernel/">kernel</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/linux/">linux</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/lisp/">lisp</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/lua/">lua</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/makefile/">makefile</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/malloc/">malloc</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/math/">math</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/maxima/">maxima</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/memory/">memory</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/memory-overflow/">memory overflow</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mtrace/">mtrace</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/netdisk/">netdisk</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/network/">network</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/others/">others</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/pandoc/">pandoc</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/performance/">performance</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/person/">person</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/protobuf/">protobuf</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/python/">python</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/rsync/">rsync</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sed/">sed</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/shell/">shell</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/skype/">skype</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sms/">sms</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/source/">source</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/ssh/">ssh</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/stack/">stack</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/storage/">storage</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/study/">study</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/svn/">svn</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sync/">sync</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/test/">test</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/time/">time</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/tools/">tools</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/valgrind/">valgrind</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/vi/">vi</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/vim/">vim</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/virtual/">virtual</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/wget/">wget</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/windows/">windows</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/wireshark/">wireshark</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/write/">write</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/xml/">xml</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Nuage de mot-clés</h3>
    <div class="widget tagcloud">
      <a href="/tags/FAQ/" style="font-size: 10px;">FAQ</a> <a href="/tags/IRC/" style="font-size: 10px;">IRC</a> <a href="/tags/Translation/" style="font-size: 13px;">Translation</a> <a href="/tags/android/" style="font-size: 10px;">android</a> <a href="/tags/api/" style="font-size: 10px;">api</a> <a href="/tags/assembly/" style="font-size: 10px;">assembly</a> <a href="/tags/awk/" style="font-size: 11px;">awk</a> <a href="/tags/batch/" style="font-size: 14px;">batch</a> <a href="/tags/blog/" style="font-size: 10px;">blog</a> <a href="/tags/book/" style="font-size: 10px;">book</a> <a href="/tags/c/" style="font-size: 16px;">c</a> <a href="/tags/c/" style="font-size: 19px;">c++</a> <a href="/tags/cache/" style="font-size: 10px;">cache</a> <a href="/tags/crash/" style="font-size: 10px;">crash</a> <a href="/tags/database/" style="font-size: 17px;">database</a> <a href="/tags/debug/" style="font-size: 12px;">debug</a> <a href="/tags/dot/" style="font-size: 10px;">dot</a> <a href="/tags/driver/" style="font-size: 10px;">driver</a> <a href="/tags/emacs/" style="font-size: 11px;">emacs</a> <a href="/tags/exploit/" style="font-size: 10px;">exploit</a> <a href="/tags/file-system/" style="font-size: 10px;">file system</a> <a href="/tags/filesystem/" style="font-size: 12px;">filesystem</a> <a href="/tags/flowchart/" style="font-size: 10px;">flowchart</a> <a href="/tags/gcc/" style="font-size: 10px;">gcc</a> <a href="/tags/git/" style="font-size: 12px;">git</a> <a href="/tags/google/" style="font-size: 11px;">google</a> <a href="/tags/graphviz/" style="font-size: 11px;">graphviz</a> <a href="/tags/hexo/" style="font-size: 10px;">hexo</a> <a href="/tags/hosts/" style="font-size: 10px;">hosts</a> <a href="/tags/iscsi/" style="font-size: 14px;">iscsi</a> <a href="/tags/java/" style="font-size: 10px;">java</a> <a href="/tags/javascript/" style="font-size: 10px;">javascript</a> <a href="/tags/job/" style="font-size: 10px;">job</a> <a href="/tags/json/" style="font-size: 10px;">json</a> <a href="/tags/kernel/" style="font-size: 14px;">kernel</a> <a href="/tags/linux/" style="font-size: 14px;">linux</a> <a href="/tags/lisp/" style="font-size: 10px;">lisp</a> <a href="/tags/lua/" style="font-size: 10px;">lua</a> <a href="/tags/makefile/" style="font-size: 10px;">makefile</a> <a href="/tags/malloc/" style="font-size: 10px;">malloc</a> <a href="/tags/math/" style="font-size: 11px;">math</a> <a href="/tags/maxima/" style="font-size: 10px;">maxima</a> <a href="/tags/memory/" style="font-size: 11px;">memory</a> <a href="/tags/memory-overflow/" style="font-size: 10px;">memory overflow</a> <a href="/tags/mtrace/" style="font-size: 10px;">mtrace</a> <a href="/tags/netdisk/" style="font-size: 10px;">netdisk</a> <a href="/tags/network/" style="font-size: 20px;">network</a> <a href="/tags/others/" style="font-size: 18px;">others</a> <a href="/tags/pandoc/" style="font-size: 10px;">pandoc</a> <a href="/tags/performance/" style="font-size: 16px;">performance</a> <a href="/tags/person/" style="font-size: 11px;">person</a> <a href="/tags/protobuf/" style="font-size: 11px;">protobuf</a> <a href="/tags/python/" style="font-size: 10px;">python</a> <a href="/tags/rsync/" style="font-size: 10px;">rsync</a> <a href="/tags/sed/" style="font-size: 11px;">sed</a> <a href="/tags/shell/" style="font-size: 15px;">shell</a> <a href="/tags/skype/" style="font-size: 11px;">skype</a> <a href="/tags/sms/" style="font-size: 10px;">sms</a> <a href="/tags/source/" style="font-size: 11px;">source</a> <a href="/tags/ssh/" style="font-size: 10px;">ssh</a> <a href="/tags/stack/" style="font-size: 10px;">stack</a> <a href="/tags/storage/" style="font-size: 15px;">storage</a> <a href="/tags/study/" style="font-size: 10px;">study</a> <a href="/tags/svn/" style="font-size: 11px;">svn</a> <a href="/tags/sync/" style="font-size: 10px;">sync</a> <a href="/tags/test/" style="font-size: 11px;">test</a> <a href="/tags/time/" style="font-size: 10px;">time</a> <a href="/tags/tools/" style="font-size: 16px;">tools</a> <a href="/tags/valgrind/" style="font-size: 10px;">valgrind</a> <a href="/tags/vi/" style="font-size: 10px;">vi</a> <a href="/tags/vim/" style="font-size: 14px;">vim</a> <a href="/tags/virtual/" style="font-size: 11px;">virtual</a> <a href="/tags/wget/" style="font-size: 10px;">wget</a> <a href="/tags/windows/" style="font-size: 11px;">windows</a> <a href="/tags/wireshark/" style="font-size: 10px;">wireshark</a> <a href="/tags/write/" style="font-size: 13px;">write</a> <a href="/tags/xml/" style="font-size: 10px;">xml</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/07/">July 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/04/">April 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/03/">March 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/02/">February 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/01/">January 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/11/">November 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/10/">October 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/09/">September 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/08/">August 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/07/">July 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/06/">June 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/03/">March 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/02/">February 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/01/">January 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/12/">December 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/11/">November 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/09/">September 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/08/">August 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/07/">July 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/06/">June 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/05/">May 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/04/">April 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/03/">March 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/11/">November 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/10/">October 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/09/">September 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/08/">August 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/07/">July 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/06/">June 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/05/">May 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/04/">April 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/03/">March 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/02/">February 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/01/">January 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2012/12/">December 2012</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2012/09/">September 2012</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Articles récents</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2016/07/17/how-to-implement-malloc/">如何实现一个malloc</a>
          </li>
        
          <li>
            <a href="/2016/07/17/study-grep-more/">grep工作原理</a>
          </li>
        
          <li>
            <a href="/2016/07/17/2016-04-13-malloc/">malloc</a>
          </li>
        
          <li>
            <a href="/2016/04/27/include-what-you-use/">使用IWYU整理头文件引用</a>
          </li>
        
          <li>
            <a href="/2016/04/24/understand-gcc-assembly-output/">understand gcc assembly output</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2016 Matrix207<br>
      Propulsé by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/script.js"></script>

  </div>
</body>
</html>